Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split out []byte-array generation for core-library namespaces #345

Merged
merged 9 commits into from
Feb 6, 2020

Conversation

jcburley
Copy link
Contributor

@jcburley jcburley commented Feb 5, 2020

This eliminates the need to hand-maintain the declaration of the []byte arrays, allowing gen_data.go to automatically generate those declarations and initialization (statically, in a func init(), or in a lazily-called function) as it sees fit. internalLibs would be empty for gen_data, but that seems appropriate, and it works fine.

Something like this might be a next step towards addressing #326 and/or #344.

(data.go might be a better name than procs_data.go?)

This eliminates the need to hand-maintain the declaration of the []byte arrays, allowing `gen_data.go` to generate those declarations and initialization (statically, in a func init(), or in a lazily-called function) as it sees fit.
Strangely, the original approach (initializing within `func init()`) makes the test suite run seconds faster on my AMD Ryzen 3 (running Ubuntu), and I suspect the same will be the case on my MacBook Pro (another amd64).
@candid82
Copy link
Owner

candid82 commented Feb 6, 2020

(data.go might be a better name than procs_data.go?)

Not sure... I am not even sure it's worth creating a separate file for those functions...Granted procs.go has become a kitchen sink but I am not sure if many small files are necessarily better. What do you think?

@candid82
Copy link
Owner

candid82 commented Feb 6, 2020

I guess procs_data.go would be excluded in fast_init build? In that case it does make sense to have it as a separate file...

@jcburley
Copy link
Contributor Author

jcburley commented Feb 6, 2020

I guess procs_data.go would be excluded in fast_init build? In that case it does make sense to have it as a separate file...

Actually, it's excluded when building/running gen_data -- that's what drove moving that stuff there. Else there'd be conflicts.

I think I prefer the name data.go for it though.

@candid82
Copy link
Owner

candid82 commented Feb 6, 2020

I saw that it's excluded in gen_data build, but I did not realize it was necessary to exclude it. What conflicts would it cause?

@jcburley
Copy link
Contributor Author

jcburley commented Feb 6, 2020

I saw that it's excluded in gen_data build, but I did not realize it was necessary to exclude it. What conflicts would it cause?

"Conflicts" was the wrong word, actually.

Since gen_data generates the declarations of []byte vars, the code in data.go won't build until gen_data has run.

This might seem a bit strange for now, but I've got another PR following it up that removes all but the references to the linter []byte vars from data.go.

@candid82
Copy link
Owner

candid82 commented Feb 6, 2020

Ah, that makes sense. Thanks!

@candid82 candid82 merged commit 46d6873 into candid82:master Feb 6, 2020
@jcburley jcburley deleted the split-lib-data branch February 7, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants